package com.wulis.common.exception;

import com.wulis.common.model.enums.HttpStatusEnum;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 业务异常类
 *
 * @author wuligao
 * @date 2020/3/27 14:22
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException {
    
    /**
     * 状态码
     */
    private int code;
    
    /**
     * 提示信息
     */
    private String message;
    
    public BusinessException(HttpStatusEnum httpStatus) {
        this.code = httpStatus.code();
        this.message = httpStatus.message();
    }
    
    public BusinessException(HttpStatusEnum httpStatus, String message) {
        this.code = httpStatus.code();
        this.message = message;
    }
}
